Skip to content

test(memory): isolate the global config dir per test file (CI fix) - #237

Merged
LeXwDeX merged 1 commit into
devfrom
fix/memory-ci-global-config-isolation
Aug 12, 2026
Merged

test(memory): isolate the global config dir per test file (CI fix)#237
LeXwDeX merged 1 commit into
devfrom
fix/memory-ci-global-config-isolation

Conversation

@LeXwDeX

@LeXwDeX LeXwDeX commented Aug 12, 2026

Copy link
Copy Markdown
Owner

第二轮 CI 调查确认根因:bun test 单进程顺序执行共享一个 XDG 配置目录——先前文件触发全局 memory 初始化留下含外来 model 的有效 memory.jsonc → writeGlobal 静默 no-op → load 外来 model → resolveModel 失败(警告被 TestConsole 吞)→ search 静默 "unavailable"。修复:per-file 钉死 OPENCODE_CONFIG_DIR + writeGlobal 后 tripwire 断言 model。产品加固(writeGlobal 拒绝覆盖时应打日志)登记为独立项。

Fixes #233

🤖 Generated with Claude Code

Second dev-CI failure investigation (run 31648866555) with the
identity-fixture fix in place: the same assertion still failed, still
with no visible warning. Verified root cause: bun test runs all files in
ONE process, sequentially, sharing one XDG_CONFIG_HOME. A file that runs
before this one and triggers global-memory initialization (memory.test
prepare, or instance boot via bootstrap.ts memory.init) leaves a VALID
global memory.jsonc whose model this file's fake provider does not know.
writeGlobal then silently no-ops over the valid file (config.ts returns
false), configuration() loads the foreign model, resolveModel fails (the
warning is captured by TestConsole and never reaches CI logs), and
search fails closed with "unavailable". R1-00's identical flow passes
because R1-07's finalizer removes the global file in between. CI-only
because bun's file order is deterministic per filesystem state and the
fresh CI checkout orders a contaminator before this file.

Fix: pin a private OPENCODE_CONFIG_DIR per file (beforeAll/afterAll,
live env getter — globalConfigDir reads it at call time) so the global
file can never be contaminated by earlier files, plus a tripwire
assertion after writeGlobal that the loaded global config carries the
expected model.

Registered separately (product hardening): writeGlobal should log when
it declines to overwrite an existing valid config.

Co-Authored-By: Claude <noreply@anthropic.com>
@LeXwDeX
LeXwDeX merged commit 7ec5673 into dev Aug 12, 2026
5 checks passed
@LeXwDeX
LeXwDeX deleted the fix/memory-ci-global-config-isolation branch August 12, 2026 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant